


menu_pointer = 0
menu_level = 0 # 0主界面 1debug界面 2图像界面
menu_debug = [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]

menu_show_flag = True

def menu_show():
    global menu_pointer,menu_level,menu_show_flag,
    if menu_level == 0: # 主界面
        lcd.str16(0,0,"debug",0x07E0)
        lcd.str16(0,16,"image",0x07E0)
        lcd.str16(0,32,"run",0x07E0)
        lcd.str16(150,16*menu_pointer,"PP",0x07E0)
    if menu_level == 1: # debug界面
        lcd.str16(0,0,"gyro_P:{:.3f}".format(menu_debug[0]),0x07E0)
        lcd.str16(0,16,"gyro_D:{:.3f}".format(menu_debug[1]),0x07E0)
        lcd.str16(0,32,"angle_P:{:.3f}".format(menu_debug[2]),0x07E0)
        lcd.str16(0,48,"angle_D:{:.3f}".format(menu_debug[3]),0x07E0)
        lcd.str16(0,64,"speed_P:{:.3f}".format(menu_debug[4]),0x07E0)
        lcd.str16(0,80,"speed_I:{:.3f}".format(menu_debug[6]),0x07E0)
        lcd.str16(0,96,"speed_D:{:.3f}".format(menu_debug[5]),0x07E0)
        lcd.str16(0,112,"SetSpeed:{:.3f}".format(menu_debug[7]),0x07E0)
        lcd.str16(150,16*menu_pointer,"PP",0x07E0)


    if menu_level == 2: # 图像界面
        lcd.wave(0, 0,128, 64, ccd1_data, max = 4095)
        lcd.wave(0, 64,128, 64, ccd2_data, max = 4095)
        lcd.str16(0,128,"ccd1: l:{:0>3d} r:{:0>3d}".format(my_ccd.ccd1_left_idx,my_ccd.ccd1_right_idx),0x07E0)
        lcd.str16(0,144,"ccd2: l:{:0>3d} r:{:0>3d}".format(my_ccd.ccd2_left_idx,my_ccd.ccd2_right_idx),0x07E0)
      















